person={"name":"cc","age":19}
person1={"gender":"nan","height":"169"}
print(person)
print(person.get("name"))
print(person.get("height"))
print(person.get("gender"),"nan")
person.update(person1)
print(person)
# 字典遍历的四种方法
for x in person:
    print(x,"=",person[x])

for i in person.items():
    print(i)

for k,v in person.items():
    print(k,"=",v)

print(person.items())

# 字典推导式
# 方法一
person1={}
for k,v in person.items():
    person1[v]=k
print(person1)
# 方法二
person2={v:k for k,v in person.items()}
print(person2)